#{extends 'main.html' /}
#{if user == editedUser}
    #{set title:'Change your password' /}
#{/if}
#{else}
    #{set title:'Change password' /}
#{/else}
#{set hasForm: true /}

#{if user == editedUser}
    <h1>Change your password</h1>
#{/if}
#{else}
    <h1>Change #{user editedUser/}´s password</h1>
#{/else}

<ul class="nav nav-tabs">
    <li><a href="@{LoggedInUsers.editForm(editedUser.userName)}"  title="General Information">Information</a></li>
    <li class="active"><a href="#" title="Change password" onclick="return false;">Change password</a></li>
</ul>

#{form action: @LoggedInUsers.passwordEdit(editedUser.userName), class: "form-horizontal"}

<fieldset>
    <legend>Change password</legend>
    #{if user != null && !user.isAdmin}
        <div class="control-group #{errorClassBootstrap 'oldPassword'/}">
            <label class="control-label" for="oldPassword">Old Password</label>
            <div class="controls">
                <input type="password" name="oldPassword" value="${flash.oldPassword}" maxlength="${util.Util.VARCHAR_SIZE}"/>
                <span class="help-inline">​#{error 'oldPassword'/}</span>
            </div>
        </div>
    #{/if}
    <div class="control-group #{errorClassBootstrap 'password'/}">
        <label class="control-label" for="password">New Password</label>
        <div class="controls">
            <input type="password" name="password" value="${flash.password}" maxlength="${util.Util.VARCHAR_SIZE}"/>
            <span class="help-inline">​#{error 'password'/}</span>
        </div>
    </div>
    <div class="control-group #{errorClassBootstrap 'password2'/}">
        <label class="control-label" for="password2">Password confirmation</label>
        <div class="controls">
            <input type="password" name="password2" value="${flash.password2}" maxlength="${util.Util.VARCHAR_SIZE}"/>
            <span class="help-inline">​#{error 'password2'/}</span>
        </div>
    </div>
    <div class="form-actions">
        <a href="@{Users.view(editedUser.userName)}" class="btn" title="Go back to profile">Cancel</a>​
        <input type="submit" class="btn btn-primary" value="Save password" title="Save password"/>
    </div>
</fieldset>

#{/form}
